package com.cn.shuangzi.userinfo.adp;

import android.content.Context;

import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.cn.shuangzi.R;
import com.cn.shuangzi.adp.SZBaseAdp;
import com.cn.shuangzi.bean.ActivelyPaymentInfo;
import com.cn.shuangzi.common.SZConst;
import com.cn.shuangzi.util.SZDateUtil;
import com.cn.shuangzi.util.SZUtil;
import com.cn.shuangzi.util.SZValidatorUtil;

import java.util.Date;
import java.util.List;

import androidx.annotation.Nullable;

/**
 * Created by CN.
 */
public class ContinuePayManageAdp extends SZBaseAdp<ActivelyPaymentInfo> {

    public ContinuePayManageAdp(Context context, @Nullable List<ActivelyPaymentInfo> data) {
        super(context, R.layout.adp_continue_pay_manage, data,R.string.txt_empty_continue_pay);
        addChildClickViewIds(R.id.txtCancel);
    }

    @Override
    public void convertView(BaseViewHolder holder, ActivelyPaymentInfo item) {
        holder.setText(R.id.txtTitle,item.getFpName());
        String payType = SZUtil.getPayTypeName((item.getAppaType()));
        if(SZValidatorUtil.isValidString(payType)){
            holder.setGone(R.id.lltPayType,false);
            holder.setText(R.id.txtPayType,payType);
        }else{
            holder.setGone(R.id.lltPayType,true);
        }
        holder.setText(R.id.txtPayMoney,"¥"+ SZUtil.getDoubleShow(item.getAppaPaymentPrice()));
        holder.setText(R.id.txtDate, SZDateUtil.getShowYearMonthDate(new Date(item.getAppaSignTime())));
    }
}
